#include "keyboard_manager.h"
#include "util.h"
#include <stdlib.h>

static void virtualkeyboard(struct wl_listener *listener, void *data)
{
#if 0
    struct wlr_virtual_keyboard_v1 *keyboard = data;
    struct wlr_input_device *device = &keyboard->input_device;
    createkeyboard(device);
#endif
}

KeyboardManager *keyboard_manager_create(Server* server)
{
    KeyboardManager *_ = ecalloc(1, sizeof(*_));
    /*
     * Configures a seat, which is a single "seat" at which a user sits and
     * operates the computer. This conceptually includes up to one keyboard,
     * pointer, touch, and drawing tablet device. We also rig up a listener to
     * let us know when new input devices are available on the backend.
     */
    wl_list_init(&_->keyboards);

    _->virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(server->dpy);
    wl_signal_add(&_->virtual_keyboard_mgr->events.new_virtual_keyboard,
            &_->new_virtual_keyboard);
    _->new_virtual_keyboard.notify = virtualkeyboard;


    return _;
}

void keyboard_manager_destroy(KeyboardManager *keyboard_manager)
{
    free(keyboard_manager);
}
